The parallel study

library(FAIRsimulator)
set.seed(32423)

Create the study

StudyObjIni <- createStudy(
  nCohorts = 1,
  recruitmentAges = list(c(6,7)*30),
  nSubjects = c(500),
  cohortStartTimes = c(6*30),
  newCohortLink = list(NULL),
  Recruitmentfunction=function(...) {return(5000)},
  samplingDesign = list(seq(0,12,by=2)*30),
  studyStopTime = 18*30+1,
  latestTimeForNewBirthCohorts=6*30,
  treatments =list(c("SoC-1","TRT-1","TRT-2","TRT-3","TRT-4")),
  effSizes = list(c(0.05,0.1,0.15,0.20,0.25)),
  randomizationProbabilities = list(rep(0.20,5)),
  minAllocationProbabilities = list(c(0.2,rep(0,4)))
  )

Run the study

The study is simulated with the AdaptiveStudy function.

StudyObj <- AdaptiveStudy(StudyObjIni)

Visualise the results

The simulated HAZ data

The simulated HAZ values can be inspected using the plotHAZ function.

plotHAZ(StudyObj)

The randomization probabilities

tmp <- getProbData(StudyObj,strProb = "UnWeightedUpdateProbabilities",cohortAgeNames="6-18 months")
kable(tmp %>% select(TreatmentName,Prob))

Multirun

iter   <- 100
ncores <- 7

myMultStud <- runMultiSim(StudyObjIni,iter=iter,ncores=ncores)
probDf                <- myMultStud[[2]]  # The Randomization probabilities
probDfUnweightedUpdate <- getMultiProbList(myMultStud[[1]],ncores=ncores,strProb="UnWeightedUpdateProbabilities")  


eniclas/FAIRsimulator documentation built on May 16, 2019, 5:12 a.m.